<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>用户登录切换案例</title>
</head>
<body>
  <div id="app">
    <span v-if="isUser">
      <label for="username">用户账号</label> <!-- label标签的for属性是对应input标签的id属性 -->
      <input type="text" id="username" placeholder="请输入用户账号">
    </span>
    <span v-else>
      <label for="email">用户邮箱</label>
      <input type="text" id="email" placeholder="@qq.com">
    </span>

    <button @click="changeInputType">切换类型</button>
  </div>

  <script src="../js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
       isUser: 'true',
      },
      methods: {
        changeInputType() {
          this.isUser = !this.isUser;
        }
      }
    })
  </script>
</body>
</html>